
//================================================================================
LOCO_FORCE_INLINE Vector2::Vector2(float x_val, float y_val) : x(x_val), y(y_val)
{

}

//================================================================================
LOCO_FORCE_INLINE Vector2::Vector2(float value) : x(value), y(value)
{

}

//================================================================================
LOCO_FORCE_INLINE Vector2 Vector2::operator-() const
{
	return Vector2(-x, -y);
}

//================================================================================
LOCO_FORCE_INLINE Vector2 Vector2::operator+(Vector2 const& in) const
{
	return Vector2(x + in.x, y + in.y);
}

//================================================================================
LOCO_FORCE_INLINE Vector2 Vector2::operator-(Vector2 const& in) const
{
	return Vector2(x - in.x, y - in.y);
}

//================================================================================
LOCO_FORCE_INLINE Vector2 Vector2::operator*(Vector2 const& in) const
{
	return Vector2(x * in.x, y * in.y);
}

//================================================================================
LOCO_FORCE_INLINE Vector2 Vector2::operator/(Vector2 const& in) const
{
	return Vector2(x / in.x, y / in.y);
}

//================================================================================
LOCO_FORCE_INLINE Vector2& Vector2::operator+=(Vector2 const& in)
{
	x += in.x;
	y += in.y;
	return *this;
}

//================================================================================
LOCO_FORCE_INLINE Vector2& Vector2::operator-=(Vector2 const& in)
{
	x -= in.x;
	y -= in.y;
	return *this;
}

//================================================================================
LOCO_FORCE_INLINE Vector2& Vector2::operator*=(Vector2 const& in)
{
	x *= in.x;
	y *= in.y;
	return *this;
}

//================================================================================
LOCO_FORCE_INLINE Vector2& Vector2::operator/=(Vector2 const& in)
{
	x /= in.x;
	y /= in.y;
	return *this;
}

//================================================================================
LOCO_FORCE_INLINE bool Vector2::operator==(Vector2 const& in) const
{
	return (x == in.x) && (y == in.y);
}

//================================================================================
LOCO_FORCE_INLINE bool Vector2::operator!=(Vector2 const& in) const
{
	return (x != in.x) || (y != in.y);
}

//================================================================================
LOCO_FORCE_INLINE bool Vector2::operator>(Vector2 const& in) const
{
	return (x > in.x) && (y > in.y);
}

//================================================================================
LOCO_FORCE_INLINE bool Vector2::operator<(Vector2 const& in) const
{
	return (x < in.x) && (y < in.y);
}

//================================================================================
LOCO_FORCE_INLINE bool Vector2::operator>=(Vector2 const& in) const
{
	return (x >= in.x) && (y >= in.y);
}

//================================================================================
LOCO_FORCE_INLINE bool Vector2::operator<=(Vector2 const& in) const
{
	return (x <= in.x) && (y <= in.y);
}

//================================================================================
LOCO_FORCE_INLINE float Vector2::norm() const
{
	return sqrt(x*x + y*y);
}

//================================================================================
LOCO_FORCE_INLINE float Vector2::square_norm() const
{
	return x*x + y*y;
}

//================================================================================
LOCO_FORCE_INLINE Vector2 Vector2::normalize() const
{
	return Vector2(x, y) / norm();
}

//================================================================================
LOCO_FORCE_INLINE bool Vector2::near_equal(Vector2 const& a, Vector2 const& b, float delta)
{
	return loco::near_equal(a.x, b.x, delta) && loco::near_equal(a.y, b.y, delta);
}

//================================================================================
LOCO_FORCE_INLINE Vector2 Vector2::reflection(Vector2 const& in, Vector2 const& normal)
{
	return   in - normal * (2.0f * Vector2::dot(in, normal));
}

//================================================================================
LOCO_FORCE_INLINE float Vector2::distance(Vector2 const& a, Vector2 const& b)
{
	return (a - b).norm();
}

//================================================================================
LOCO_FORCE_INLINE float Vector2::square_distance(Vector2 const& a, Vector2 const& b)
{
	return (a - b).square_norm();
}

//================================================================================
LOCO_FORCE_INLINE float Vector2::dot(Vector2 const& a, Vector2 const& b)
{
	return a.x*b.x + a.y*b.y;
}

//================================================================================
LOCO_FORCE_INLINE Vector2 Vector2::lerp(Vector2 const& a, Vector2 const& b, float value)
{
	return Vector2(loco::lerp(a.x, b.x, value), loco::lerp(a.y, b.y, value));
}

//================================================================================
LOCO_FORCE_INLINE Vector2 Vector2::lerp(Vector2 const& a, Vector2 const& b, Vector2 const& value)
{
	return Vector2(loco::lerp(a.x, b.x, value.x), loco::lerp(a.y, b.y, value.y));
}


